'''Fake module to make eclipse/pydev/pylint happy! This will eventually be 
used as a testing environment for new code with *fake* triggers and the 
like. Please excuse poor code style, etc. This is a fast written *hack* 
to make code checkers shut up about certain aspects of life.'''
############################################################################
#    Copyright (C) 2006 by Robert Small                                    #
#    SmallR2002@Gmail.com                                                  #
#                                                                          #
#    This program is free software; you can redistribute it and#or modify  #
#    it under the terms of the GNU General Public License as published by  #
#    the Free Software Foundation; either version 2 of the License, or     #
#    (at your option) any later version.                                   #
#                                                                          #
#    This program is distributed in the hope that it will be useful,       #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
#    GNU General Public License for more details.                          #
#                                                                          #
#    You should have received a copy of the GNU General Public License     #
#    along with this program; if not, write to the                         #
#    Free Software Foundation, Inc.,                                       #
#    59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             #
############################################################################

#@PydevCodeAnalysisIgnore

#True to form.
EAT_ALL = 3
EAT_NONE = 0
EAT_XCHAT = 1
EAT_PLUGIN = 2

#True to form.
PRI_HIGHEST = 127
PRI_HIGH = 64
PRI_NORM = 0
PRI_LOW = -64

#Blah init stuff
__x_away = "Moo"

# Generic functions
def prnt(string):
    '''Prints within the current context.'''
    print "000: " + string
    return True

def emit_print(event_name, *args):
    '''*Creates* an event.'''
    print event_name
    print args
    return True

def command(string):
    '''Executes a command.'''
    print "001:" + string
    return True

def nickcmp(s1, s2):
    '''Does a nick comparison between two strings.'''
    if s1.lower() == s2.lower():
        return True
    else:
        return False


# Information retreiving functions

def get_info(xtype):
    '''Queries information about xtype.'''
    xtype = xtype.lower()
    temp = None
    
    if (xtype == "away"):
        temp = __x_away
    elif(xtype == "channel"):
        temp = "#chat"
    elif(xtype == "network"):
        temp = "A Network"
    elif(xtype == "nick"):
        temp = "Fred"
    elif(xtype == "server"):
        temp =  "An IRC server."
    elif(xtype == "topic"):
        temp = "Moo!"
    elif(xtype == "version"):
        temp = "Fake XChat 2.1.1.1.2.1.1.1 rc23"
    elif(xtype == "xchatdir"):
        temp = "/home/user/.xchat2"
        
    return temp

def get_prefs(name):
    '''Get a preference.'''
    print name
    return "Not supported yet, sorry!"

def get_list(ltype):
    '''Get information held within *this* list'''
    # channels
    # dcc
    # users
    # ignore
    print ltype
    return ltype

# Hook functions

def hook_command(name, callback, userdata=None, priority=PRI_NORM, xhelp=None):
    '''Hook a command up to a procedure.'''
    print name
    print callback
    print userdata
    print priority
    print xhelp
    return True

def hook_print(name, callback, userdata=None, priority=PRI_NORM):
    '''Hook a print event up to a procedure'''
    print name
    print callback
    print userdata
    print priority
    print help
    return True

def hook_server(name, callback, userdata=None, priority=PRI_NORM):
    '''Raw hooking of prints, pretty much.'''
    print name
    print callback
    print userdata
    print priority
    return True

def hook_timer(timeout, callback, userdata=None):
    '''Creates a timer, a bit like /timer.'''
    print timeout
    print callback
    print userdata
    return True

def hook_unload(timeout, callback, userdata=None):
    '''Check for unloading the plugin.'''
    print timeout
    print callback
    print userdata
    return True

def unhook(handler):
    '''Unhook *anything*'''
    print handler
    return True

# Context handling

def get_context():
    '''Get the context of *now*.'''
    temp = context
    return temp

def find_context(server=None, channel=None):
    '''
    Get the context.
    '''
    print server
    print channel
    return True

class context:
    '''The context '''
    @staticmethod
    def set():
        '''Changes the current context to be the one represented by this context object.'''
        return True
    @staticmethod 
    def prnt(string):
        '''Does the same as the xchat.prnt() function, but in the given context. '''
        print string
        return True
    @staticmethod 
    def emit_print(event_name, *args):
        '''Does the same as the emit_print() function, but in the given context. '''
        print event_name
        print args
        return True
    @staticmethod 
    def command(string):
        '''Does the same as the xchat.command() function, but in the given context. '''
        print string
        return True
    @staticmethod 
    def get_info(xtype):
        '''Does the same as the xchat.get_info() function, but in the given context. '''
        print xtype
        return True
    @staticmethod 
    def get_list(xtype):
        '''Does the same as the xchat.get_list() function, but in the given context.'''
        print xtype
        return True
    def __init__(self):
        print "Woo!"